package safe.yunchexing.com.cloudsafe;

import android.app.Application;
import android.content.Context;
import android.telephony.TelephonyManager;

import cloudcar.yunchexing.com.cloudlibrary.CXImageLoader;
import safe.yunchexing.com.cloudsafe.utils.app.DeviceUtils;
import safe.yunchexing.com.cloudsafe.utils.log.Logger;

/**
 * Created by lixiaoming on 16/4/5.
 */
public class CloudApplication extends Application {

    /**
     * 是否是Debug模式 *
     */
    private static final boolean DEBUG = true;

    private static Context context;

    public boolean isDebug() {
        return DEBUG;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        context = this;

        initApplication();
        Logger.i("lxm", "UUID = " + DeviceUtils.getAndroidId(this));

        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

         String a = tm.getDeviceId();

        Logger.i("lxm", "a = " + a);

    }

    /**
     * 初始化
     */
    private void initApplication() {

        CXImageLoader.getInstance().init(getContext());
    }

    /**
     * 得到全局上下文对象
     *
     * @return
     */
    public Context getContext() {
        return context;
    }

    /**
     * 单例模式
     **/
    public static CloudApplication getInstance() {
        return Singleton.INSTANCE;
    }

    private static final class Singleton {

        private static final CloudApplication INSTANCE = new CloudApplication();
    }

}
